<?php

namespace app\api\model;

use think\Model;

class User extends Model
{
    //开启自动完成时间戳功能
    protected $autoWriteTimestamp = true;
    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

    /**
     * Notes:用户详情
     * User: tangfen
     * Date: 2023/12/21
     * Time: 20:48
     */
    public function details($uid)
    {
        $result = $this->where(['id' => $uid])->find();
        if (empty($result)) {
            return false;
        } else {
            return $result;
        }
    }

    /**
     * Notes:编辑用户信息
     * User: tangfen
     * Date: 2024/1/3
     * Time: 19:18
     */
    public function editUser($uid, $params)
    {
        $result = $this->where(['id' => $uid])->update($params);
        if ($result !== false) {
            return true;
        } else {
            return false;
        }
    }


}